home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Sources / SLGrGlob.cpp < prev    next >
Encoding:
Text File  |  1996-04-25  |  2.1 KB  |  79 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLGrGlob.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWOS.hpp"
  11.  
  12. #ifndef SLGRGLOB_H
  13. #include "SLGrGlob.h"
  14. #endif
  15.  
  16. #ifndef FWPRIDEB_H
  17. #include "FWPriDeb.h"
  18. #endif
  19.  
  20. //========================================================================================
  21. //    RunTime Info
  22. //========================================================================================
  23.  
  24. #ifdef FW_BUILD_MAC
  25. #pragma segment fwgraphx
  26. #endif
  27.  
  28. //========================================================================================
  29. //    Graphics globals
  30. //========================================================================================
  31.  
  32. #ifdef FW_BUILD_MAC
  33. CGrafPort        FW_gPrivScratchPortRecord;
  34. GrafPtr            FW_gScratchPort = NULL;
  35. #endif
  36.  
  37. static short    gRefCount = 0;
  38.  
  39. //----------------------------------------------------------------------------------------
  40. // FW_PrivInitializeGraphicsGlobals
  41. //----------------------------------------------------------------------------------------
  42.  
  43. void SL_API FW_PrivInitializeGraphicsGlobals()
  44. {
  45.     if (++ gRefCount == 1)
  46.     {
  47. #ifdef FW_BUILD_MAC
  48.         FW_ASSERT (FW_gScratchPort == NULL);
  49.  
  50. #if defined(__MWERKS__) && GENERATING68K
  51.         Rect rBounds;
  52.         rBounds.top = rBounds.left = 0;
  53.         rBounds.right = rBounds.bottom = 0;
  54. #else
  55.         Rect rBounds = { 0, 0, 10 , 10 };
  56. #endif
  57.         
  58.         ::OpenCPort(&FW_gPrivScratchPortRecord);
  59.         FW_gScratchPort = (GrafPtr)&FW_gPrivScratchPortRecord;
  60. #endif
  61.     }
  62. }
  63.  
  64. //----------------------------------------------------------------------------------------
  65. // FW_PrivTerminateGraphicsGlobals
  66. //----------------------------------------------------------------------------------------
  67.  
  68. void SL_API FW_PrivTerminateGraphicsGlobals()
  69. {
  70.     if (-- gRefCount == 0)
  71.     {
  72. #ifdef FW_BUILD_MAC
  73.         FW_ASSERT(FW_gScratchPort != NULL);
  74.         ::CloseCPort(&FW_gPrivScratchPortRecord);
  75.         FW_gScratchPort = NULL;
  76. #endif
  77.     }
  78. }
  79.